package com.cql.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin
@RequestMapping("/cql")
public class SayHelloController {

    //openfeign风格的请求方式，传统的get和post请求方式
    @RequestMapping(value = "/hello", method = RequestMethod.POST)
    public String sayHello(@RequestParam("name") String name, HttpServletRequest servletRequest) {
            System.out.println(name);
        return "Hello.".concat(name).concat("!");


       // return new Person("a", 1);
    }

    @RequestMapping("/rest/{name}")
    public String restHello(@PathVariable("name") String name) {
        return "rest.03 ".concat(name);
    }


    @RequestMapping(value = "/hello/{name}", method = RequestMethod.GET)
    public String sayHello2(@PathVariable("name") String name, HttpServletRequest servletRequest) {
        System.out.println(name);
        return "Hello.from service3".concat(name).concat("!");


        // return new Person("a", 1);
    }

}
